package bjtu.tjj.simpledy.controller;

import bjtu.tjj.simpledy.common.CommonResult;
import bjtu.tjj.simpledy.service.LikeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("like")
public class LikeController {
    private final LikeService likeService;

    /**
     * 返回最新的点赞数
     */
    @PostMapping("{videoId}")
    public CommonResult<Integer> add(@PathVariable Long videoId) {
        return CommonResult.success(likeService.add(videoId));
    }

    /**
     * 返回最新的点赞数
     */
    @DeleteMapping("{videoId}")
    public CommonResult<Integer> delete(@PathVariable Long videoId) {
        return CommonResult.success(likeService.delete(videoId));
    }
}
